<?php
class db{
   
   function __construct(){
      
      echo "1111111111";
   }
    
   
   public static function query($sql){
       $conn = new mysqli('localhost','root','root','php');
       $conn->query('SET NAMES UTF8');
       return $conn->query($sql);
       
   }
   
}


    $sql = "select username from user";
    
    $res = db::query($sql);
    $rows = [];
     while($row = $res->fetch_array(MYSQLI_ASSOC)){
        $rows[] = $row;
     }
     var_dump($rows);
     echo "------------------------";
    print_r($rows);
    echo "------------------------";
    var_dump($_SERVER);
     foreach ($rows as $r){
         echo $r['username'];
     }
     
     echo $_SERVER['DOCUMENT_ROOT'];
  echo 'http://'.$_SERVER['HTTP_HOST'];